The present invention relates generally to a virtual device driver designed to run with Microsoft Windows 95(copyright) or Windows 98(copyright) and, more particularly, to a virtual device driver which monitors mouse data packets and discards erroneous or faulty data.
Although the keyboard is the primary computer input device in a computer system, the prevalence of graphical user interfaces (GUIs) virtually require the use pointing device such as a mouse.
A mouse uses a roller ball which rests against two rollers for translating X- and Y-axis movement into electrical signals, e.g., via an optical or opto-mechanical mechanism. A mouse will typically have a hand-sized housing and is operated by moving the mouse around on a flat surface such as a desktop or mouse pad. Similarly, a trackball is essentially the same as the mouse in terms of design, functionality, and electrical interface, but is used upside down. Rather than moving the entire device, the device is stationary with the roller ball facing upward wherein the ball may be turned with the hand directly.
Mouse button and position data are typically sent in 11-bit data bytes consisting of eight data bits plus framing and control bits. Mouse information is typically sent as three consecutive bytes. For a typical mouse such as a PS/2 mouse, the first byte of the three byte mouse data packet provides information regarding the left and right button state; the second byte of the three byte mouse data packet provides movement or displacement in the X-direction; and the third byte of the three byte mouse data packet provides movement or displacement in the Y-direction. Typically the first byte of the three byte mouse data packet will further contain data for direction of movement in the X-direction, direction of movement in the Y-direction, as well as X- and Y-overflow data bits.
In the typical mouse protocol, such as the PS/2 mouse protocol, there is no synchronization bit provided, so if a hardware communication error occurs, and one of the three bytes of the three byte mouse data packet is lost, the mouse driver will interpret the next received byte erroneously. For example, if the first data packet with button state information is lost, the second byte with X-displacement information will be erroneously interpreted as the first (button state) byte, and so forth. As a result, all subsequent mouse packets will be erroneously interpreted by the mouse driver until the mouse can be resynchronized with the driver.
It would be desirable to provide software that could improve mouse reliability by identifying and discarding faulty mouse data and resynchronizing the mouse with the mouse driver. In order to avoid replacing the standard mouse driver, which may contain very efficient hardware-dependent code, it would also be desirable to provide this functionality as a standalone virtual device driver rather than a replacement mouse driver or mouse minidriver.
The present invention is a virtual device driver (VxD) designed to run under Microsoft Windows 95(copyright) or Windows 98(copyright). A VxD is granted the same privileges as the kernel, thus having access to the memory of the kernel and all running processes as well as raw access to the hardware. The VxD according to the present invention hooks the VMD_Manipulate_Pointer_Message service provided by the Microsoft mouse driver, as documented in the Windows 95(copyright) Device Driver Kit (DDK).
The VxD according to the present invention improves mouse reliability by examining the mouse packets received by the mouse driver and taking appropriate action when necessary.
The VxD of the present invention does not use the VMD_Manipulate_Pointer_Message to transform mouse packets, which is the original, documented purpose, but rather, to remove faulty mouse packets when they are detected. Instead of transforming a detected faulty mouse packet, the faulty mouse packet is discarded and a null mouse packet is returned in its place.
The present invention is implemented as a virtual device driver rather than a replacement mouse driver or mouse minidriver. Implementing the present invention as a VxD allows the standard Microsoft mouse driver, which may have very efficient hardware-dependent code, to handle the mouse hardware. The mouse guard VxD according to the present invention is implemented as a separate VxD which hooks a documented mouse service, namely, the VMD_Manipulate_Pointer_Message mouse service, but which uses this hook in a novel way. The Windows 95(copyright) DDK documentation indicates that the VMD_Manipulate_Pointer_Message service is designed to allow manipulation of the mouse movements, including scaling and rotation operations, rather than the use made of this service by the VxD according to the present invention, i.e., detecting and discarding faulty mouse packets.
The VxD according to the present invention can be written as a generic VxD that hooks the VMD_Manipulate_Pointer_Message function of VMOUSE when it is loaded and unloads the hook when the VxD is unloaded. The VxD monitors mouse packets processed by VMOUSE. The VxD detects faulty mouse packets according to one or more prespecified criteria and removes any such mouse packets determined to be faulty.
The VxD according to the present invention installs a hook procedure that is called by the Windows 95(copyright) or Windows 98(copyright) Virtual Mouse Driver each time a mouse packet is received. Although the present invention will be described herein primarily in reference to mouse devices compatible with the PS/2 (dedicated motherboard mouse port) mouse hardware protocol, including not only a PS/2 mouse attached to a PS/2 mouse port, but also a wireless remote control device that communicates with a device that is plugged into a PS/2 mouse port, it will be understood by those skilled in the art that the present invention can also be implemented for hardware devices that are compatible with other mouse hardware protocols, including, but not limited to serial mice, bus mice, hybrid serial/motherboard mouse port mice, and the like. Although the present invention will be discussed primarily in terms of a mouse, it will be understood the present invention may also be employed with trackball pointing devices which uses the same electrical interface and data format as the mouse. Finally, the present invention also has applicability to any input device that transfers data in the form of multi-byte words for which no synchronization data, such as a synchronization bit, is provided.
As used herein, the terms xe2x80x9cmouse packetxe2x80x9d or xe2x80x9cmouse data packetxe2x80x9d will be used to refer to a set of three consecutive mouse data bytes providing button state, X-displacement, and Y-displacement information. Table 1 shows typical information for each of the three mouse data bytes that make up a mouse packet (exclusive of framing and control bits). It should be noted that protocols may vary from one manufacturer to another and that the particular protocol shown in Table 1 is exemplary only, provided to illustrate the principles of the present invention, and is in no way limiting of the present invention.
Table 1 illustrates an exemplary three byte mouse data packet where L=left button state (1=pressed down); R=right button state (1=pressed down); X0-X7=movement in the X-direction; Y0-Y7=movement in the Y-direction; XS=direction of the movement in the X-axis (1=up); YS=direction of the movement in the Y-axis (1=left); XV, YV=overflow of the movement data bits (1=overflow has occurred). For purposes of illustrating the present invention, the terms xe2x80x9cfirst bytexe2x80x9d and xe2x80x9cbutton state bytexe2x80x9d will be used synonymously herein, as will the terms xe2x80x9csecond byte,xe2x80x9d xe2x80x9cX-displacement byte,xe2x80x9d and xe2x80x9cdelta-X byte,xe2x80x9d and as will the terms xe2x80x9cthird byte,xe2x80x9d xe2x80x9cY-displacement byte,xe2x80x9d and xe2x80x9cdelta-Y byte.xe2x80x9d However, it will be recognized by those skilled in the art that other configurations are possible and that the present invention is not limited to any particular configuration or protocol.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention as claimed. The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and together with the general description, serve to explain the principles of the invention.